package com.yu.gulimall.product.exception;

import com.yu.common.exception.BizCodeEnume;
import com.yu.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ResponseBody
@ControllerAdvice(basePackages = "com.yu.gulimall.product.controller")
public class GulimallExceptionCotrollerAdvice {

    @ExceptionHandler(value = {Throwable.class})
    public R handleVaildException(Throwable e){
        return R.error(BizCodeEnume.UNKNOW_EXCEPTION.getCode(), BizCodeEnume.UNKNOW_EXCEPTION.getMsg());
    }
}
